Skip to content

Conversation

@Mauller
Copy link

@Mauller Mauller commented Sep 13, 2025

This PR fixes the unit information scaling within the game.
It fixes the scaling and placement of the following:

  1. health bar
  2. veterancy icon
  3. contained pips
  4. ammo pips
  5. enthusiastic and emoticon
  6. healing icon
  7. Bomb icons on structures
  8. disabled icon
  9. battleplan icons (These are currently disabled and have no data related to them so crash the game, but i tweaked the code to fix it)

The majority of the scaling now takes the zoom and difference in resolution, relative to the default resolution that the items were scaled for, into account.

Some of the scaling and placement of info is slightly altered relative to the original 800x600 implementation.
This was done as the original sizes of the information was considered excessive.

I have currently kept the bombed icon set to scale to half the size of a health bar, it makes it more obvious which buildings have been rigged. Prior to this the bombed icon was using the infantries health bar to scale itself and it was then placed at the feet of where the infantry unit used the ability instead of on the building.

@Mauller Mauller self-assigned this Sep 13, 2025
@Mauller Mauller added Bug Something is not working right, typically is user facing GUI For graphical user interface Major Severity: Minor < Major < Critical < Blocker Gen Relates to Generals labels Sep 13, 2025
@Mauller
Copy link
Author

Mauller commented Sep 13, 2025

1920x1080 with the fixes from this
image

1920x1080 without the fixes
image

@Mauller
Copy link
Author

Mauller commented Sep 15, 2025

Going to look back at the "Bombed" icons again and decouple them from the health bar size so they have a consistent size.

@Mauller
Copy link
Author

Mauller commented Sep 15, 2025

Some update on scaling the bombed icon to be a fixed size instead of scaling with the size of the health bar
image

And on a car
image

@Mauller
Copy link
Author

Mauller commented Sep 15, 2025

Fixed size on lower building with timed charge vs health scaling remote bomb on other building
image

@Mauller
Copy link
Author

Mauller commented Sep 15, 2025

Consistant size now for timed and remote charges
image

@Mauller Mauller force-pushed the fix-scaling-unit-gui branch from 6a466c8 to b3e7544 Compare September 15, 2025 18:44
@Mauller
Copy link
Author

Mauller commented Sep 15, 2025

Pushed the tweaked Timed and remote bomb scaling to be uniform in size now.

Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be easier to review if refactors and scaling changes were separated in more separated commits.

I only tested this change in 800 x 600, side by side with the Original Game and just a few of the icons.

Here are my thoughts.

  1. Zoom scaling is nice and ideally is an option in InGameUI.ini, enabled by default.
  2. Icon scaling depending on object size ideally is an option in InGameUI.ini, turned off by default.
  3. Thicker health bar outline should be configurable in InGameUI.ini, set to original size by default.
  4. Default icon size needs more consideration. It would be good to have an option to use exactly the original icon scaling, and then build all the new scaling on top of that.

Perhaps split this change into more changes. First do the refactor, then do the zoom scaling. And then do the resizing of icons with options.

Ammo icon - Original left, Patch right

Ammo icons are too narrow and small in Patch.

ammo_icon

Cargo icon - Original left, Patch right

Cargo icons are too narrow and small in Patch.

cargo_icon

Disabled icon - Original left, Patch right

Disabled icons are noticably smaller than original.

disabled_icon

Propaganda icon - Original left, Patch right

Propaganda icons now have a per object scale.

prop_icon

Repair icon - Original left, Patch right

Repair icons are significantly smaller than original.

repair_icon

}

// Display::getWidthScale =========================================================
/** Return the ratio of the current display width relative to the default resolution */
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not use /* for comments. It screws with syntax highlighting in diff tools (when spanning multiple lines).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replicating the style of the original code that is currently in place.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are // just below the new function.

//=============================================================================
Real Display::getHeightScale(void)
{
return INT_TO_REAL(m_height) / DEFAULT_DISPLAY_HEIGHT;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can just use (Real)m_height?

Int frameWidth = getIconInfo()->m_icon[ ICON_CARBOMB ]->getCurrentFrameWidth();
Int frameHeight = getIconInfo()->m_icon[ ICON_CARBOMB ]->getCurrentFrameHeight();
Int barWidth = healthBarRegion->width();;
Int barHeight = healthBarRegion->height();;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

;;

else
{
killIcon(ICON_CARBOMB);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer not deleting { } if the other side of the branch does have { }

Real healthBoxOutlineSize = 1.0f;
Real healthBoxWidth = healthBarRegion->width();
Real healthBoxHeight = max(3, healthBarRegion->height());
Real healthBoxOutlineSize = 2.0f;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a style change. Why is this done?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes it clearer to see the reduction in health relative to the outline of the health bar.

@Mauller
Copy link
Author

Mauller commented Sep 17, 2025

I did not scale many of these 1:1 with their original 800x600 scaling in the end because when i originally did that they become obnoxiously large relative to units or buildings at higher resolutions.

in regards to some of them, with the contained pip, yes they are larger when zoomed out, but the moment you zoom in they significantly shrink in size instead of remaining at a consistent size.

The ammo pips do the same thing, they considerably shrink in size compared to being over sized when zoomed out.

The enthusiastic / propaganda icons were over sized for a lot of units with their original scaling, they were nearly the size of an overlord in that particular instance but considerably shrink when you zoom since they don't maintain scaling when zooming.

The repair icon might look smaller at 800x600 when zoomed out, but when zoomed in it becomes too small in the original code etc.

Many of the things don't maintain consistent scaling in the original code so when zoomed out at 800x600 they are often significantly larger than they should be. And when that size is maintained with their scaling fixed while zooming, they become obnoxiously large at higher resolutions.

@Mauller
Copy link
Author

Mauller commented Sep 17, 2025

I will look at splitting out the changes into separate commits later.

@Mauller
Copy link
Author

Mauller commented Sep 17, 2025

Also these changes are part of Drawable and have nothing to do with InGameUi.

@xezon
Copy link

xezon commented Sep 17, 2025

I am not opposed to changing some defaults, but I think overall defaults should be close to the original, and then make new tweaks opt-in, to give designers the freedom to fine tune it. It should not be the programmers job to fine tune the appearance.

@Mauller
Copy link
Author

Mauller commented Sep 19, 2025

I will break this out then into changes that first fix the resolution scaling for everything, then add the zoom scaling for things that did not originally have it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Gen Relates to Generals GUI For graphical user interface Major Severity: Minor < Major < Critical < Blocker

Projects

None yet

2 participants